#ifndef __IPEDIT_H__
#define __IPEDIT_H__
#include "..\DuiLib\UIlib.h"

using namespace DuiLib;

class CEnterWnd;

#define DotWidth 10
#define EditColor 
class  COwnerUI : public CLabelUI
{
	friend class CEnterWnd;
public:
	COwnerUI();
	LPCTSTR GetClass() const;
	UINT GetControlFlags() const;
	void SetEnabled(bool bEnable = true);
	void SetText(LPCTSTR pstrText,int nIndex);
	void SetMaxChar(UINT uMax);
	UINT GetMaxChar();
	int GetWindowStyls() const;
	LPCTSTR GetNormalImage();
	void SetNormalImage(LPCTSTR pStrImage);
	LPCTSTR GetHotImage();
	void SetHotImage(LPCTSTR pStrImage);
	LPCTSTR GetFocusedImage();
	void SetFocusedImage(LPCTSTR pStrImage);
	LPCTSTR GetDisabledImage();
	void SetDisabledImage(LPCTSTR pStrImage);
	void SetNativeEditBkColor(DWORD dwBkColor);
	DWORD GetNativeEditBkColor() const;

	void SetSel(long nStartChar, long nEndChar);
	void SetSelAll();
	void SetReplaceSel(LPCTSTR lpszReplace);

	void SetPos(RECT rc);
	void SetVisible(bool bVisible = true);
	void SetInternVisible(bool bVisible = true);
	SIZE EstimateSize(SIZE szAvailable);
	void DoEvent(TEventUI& event);

	void PaintStatusImage(HDC hDC);
	void PaintText(HDC hDC);
	CEnterWnd* GetFull();
	void SetTextColor(DWORD dwColor);

	int GetIndexByPos(POINT ptMouse);
	void NextEditWnd(int nIndex);
	RECT GetPosByIndex(int nIndex);
	void SetDotColor(DWORD dwColor);
	void SetDotFont(int nIndex);
	UINT GetIP();
	void SetIP(UINT nIP);
	static void CALLBACK Timer(HWND hwnd,UINT uMsg, UINT_PTR idEvent,DWORD dwTime);
	void IsInRect(HWND hwnd,UINT uMsg, UINT_PTR idEvent,DWORD dwTime);
	static COwnerUI* m_pCurrent;

private:
	CEnterWnd* m_pWindow;
	
	UINT m_uButtonState;
	CDuiString m_sNormalImage;
	CDuiString m_sHotImage;
	CDuiString m_sFocusedImage;
	CDuiString m_sDisabledImage;
	DWORD m_dwEditbkColor;
	int m_iWindowStyls;
	
	DWORD m_dwTextColor;
	CEnterWnd *m_pEditWnd[4];
	RECT m_rcEdit[4];
	CDuiString m_sDisplay[4];
	int m_nIndex;
	DWORD m_dwDotColor;
	int m_nDotSize;
	int m_nDotFont;
	bool m_bFirst ;
	CDuiString m_sOneImage;
	
};

#endif // __IPEDIT_H__
